<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        input{
            float: left;
            height: 48px;
        }
        img{
            float: left;
        }
    </style>
</head>
<body>
    <input type="text"><img src="./睁眼.png" alt="">
</body>
</html>
<script>
    var inp=document.querySelector('input')
    var ime=document.querySelector('img')
    var flag=1
    ime.onclick=function(){
        if(flag==1){
            ime.src='./睁眼.png'
            inp.type='text'
            flag=0
        }else{
            ime.src='./闭眼.png'
            inp.type='password'
            flag=1
        }
    }
</script>